#!/usr/bin/python

import os
import sys
from nltk.stem.porter import PorterStemmer

sys.setrecursionlimit(10000)
fromFile = "music_theme_list_stop_words_removed"
toFile = "music_theme_list_stop_words_removed_stemming"

reader = open(fromFile, "r")
writer = open(toFile, "w")

while True:
    line = reader.readline()
    if line == "":
        break
    words = line.split()
    for word in words:
        writer.write(PorterStemmer().stem_word(word) + ' ')
    writer.write("\n")

reader.close()
writer.close()


